<?php
/**
 * 保护属性，不能在类外访问
 **/
class Cat 
{
	
	protected $gender = 'f';
	
}

class kitten extends Cat
{
	
	public $gender = 'm';
	
}

class RockCat extends Cat
{
	#子类的访问权限应该比父类相等或者更宽，否则会报错
	private $gender = 'm';
	
}

$cat  =  new Cat;

/**
 * Uncaught Error: Cannot access protected property
 **/
var_dump($cat->gender ?? 'Cannot access protected property');

$cat =  new kitten;

var_dump($cat->gender ?? 'Cannot access protected property');